<?php use Apps\Event\Common; ?>
<include file="__THEME__/public_header" />
<include file="../common/nav" />
<div class="hd-worap">
	<!-- 左边内容区 -->
	<div class="hd-leftbox">
		<!-- 场地详情 -->
		<div class="hd-detailinfo">
			<a class="hd-detailinfo-img" href="">
				<?php $url = '__APP__/image/default/hdd.jpg'; ?>
				<?php if ($data['image']) {
					$url = getImageUrlByAttachId($data['image'], 180, 255, true);
				} ?>
				<img src="{$url}" alt="{$data['name']}">
			</a>
			<div class="hd-info">
				<h2>{$data['name']} <?php if($data['recommend']) { ?> <i class="ico-recomen ml5"></i> <?php } ?></h2>
				<?php if($data['uid'] == $mid) { ?>
					<div class="hd-admin">
						<h3 id="J-admin" style="cursor: pointer;" data-item="#J-admin-item" data-show="on">管理</h3>
						<ul id="J-admin-item" style="display: none;">
							<li><a href="{:U('Event/Manage/aduit', array('eid' => $data['eid']))}">报名审核</a></li>
							<li><a href="{:U('Event/Release/edit', array('id' => $data['eid']))}">编辑场地</a></li>
							<li><a href="{:U('Event/Manage/over', array('eid' => $data['eid']))}">提前结束</a></li>
							<li><a href="{:U('Event/Manage/delEvent', array('eid' => $data['eid']))}">删除场地</a></li>
						</ul>
					</div>
				<?php } ?>
				<!-- 时间 -->
				<div>时间：{:date('Y年m月d日 H:i', $data['stime'])}&nbsp;～&nbsp;{:date('Y年m月d日 H:i', $data['etime'])}
					<?php if ($data['stime'] <= time() and $data['etime'] >= time()) { ?>
						<span class="clo-c">&nbsp;正在进行中…</span>
					<?php } ?>
				</div>
				<!-- 地点，地图 -->
				<input type="hidden" value="{$data['longitude']}" id="longitude">
				<input type="hidden" value="{$data['latitude']}" id="latitude">
				<div>地点：({$data['area']}-{$data['city']}){$data['location']}
					<!--<a class="clo-l hd-mapbox" id="J-map" href="" data-address="{$data['area']}{$data['city']} {$data['location']}" data-name="{$site.site_name}">
						<i class="hd-map"></i>
					</a>-->
					<a class="clo-l hd-mapbox" href="http://api.map.baidu.com/geocoder?address={$data['area']}{$data['city']}{$data['location']}&output=html" target="_blank">
						<i class="hd-map"></i>
					</a>
				</div>
				<!-- 费用 -->
				<div>费用：{$data['price']}RMB
					<i class="hd-jgtipbox" id="J-price-tips" data-item="#J-price-tips-box" data-empty="{$data['tips'] ? 0 : 1}">
						<div class="hd-jgtip" id="J-price-tips-box">
							<em></em><i></i>
							<span>{$data['tips']}</span>
						</div>
					</i>
				</div>
				<!-- 分类 -->
				<div>类型：{$data['cate']}</div>
				<!-- 发起人 -->
				<div>发起人：<a href="{$data['user']['space_url']}" target="_blank" uid="{$data['user']['uid']}" event-node="face_card" show="no">{$data['user']['uname']}</a></div>
				<!-- 场所 -->
				<div>场所：{$data['place']}</div>
				<!-- 操作按钮 -->
				<div class="input">
					<?php 
						$show = 'on';
						if ($data['stime'] <= time() and $data['etime'] >= time()) {
							$show = 'off';
						}
						if ($enrollment) {
							$enrollment = 1;
						} else {
							$enrollment = 0;
						}
					?>
					<?php if($ended) { ?>
						<a class="event_ended">报名结束</a>
					<?php } else { ?>
          <nosession name="mid">
            <a class="jia" href="javascript:ui.quicklogin();"><i></i>报名</a>
          </nosession>
          <session name="mid">
            <a class="{:Common::hasEcho($enrollment, 'jian', 'jia')}" id="J-enrollment" href="" data-show="{$show}" data-status="{$enrollment}" data-enrollment="{:U('Event/Info/enrollment')}" data-unenrollment="{:U('Event/Info/unEnrollment')}" data-eid="{$data['eid']}"><i></i>{:Common::hasEcho($enrollment, '取消')}报名</a>
          </session>
					<?php } ?>
					<nosession name="mid">
						<a class="jia" href="javascript:ui.quicklogin();"><i></i>关注</a>
					</nosession>
					<session name="mid">
						<a class="{:Common::hasEcho($star, 'jian', 'jia')}" id="J-star" href="" data-star="{:Common::hasEcho($star, '1', '0')}" data-eid="{$data['eid']}" data-star-url="{:U('Event/Manage/star')}" data-star-un="{:U('Event/Manage/unStar')}"><i></i>{:Common::hasEcho($star, '取消')}关注</a>
					</session>
					&nbsp;<?php if ($data['manNumber']) { ?>
					剩余<span class="clo-c">{$data['remainder']}</span>个名额
					<?php } else { ?>
					不限制名额
					<?php } ?>
				</div>
			</div>
		</div>
		<!-- content -->
		<div class="hd-details fl">
			<div class="title">
				<span></span>地图
			</div>
			<div class="hd-detacont" id="map_container" style="height:300px;">
				
			</div>
			<div class="title">
				<span></span>详情
			</div>
			<div class="hd-detacont">{$data['content']}</div>
			<volist name = 'data.attach' id = 'images'>
			<p><img src = "{$images}"></p>
			</volist>
			<volist name = 'data.video' id = 'video'>
			<p><video src = "{$video.url}" poster="{$video.imgurl}" controls="controls"></video></p>
			</volist>		
			<?php if($eventUsers and is_array($eventUsers)) { ?>
				<!-- 场地报名用户 -->
				<div class="title">
					<span></span>场地成员
				</div>
				<ul class="hd-facelist">
					<?php foreach ($eventUsers as $eventUser) { ?>
						<li>
							<a href="{$eventUser['space_url']}" target="_blank" title="{$eventUser['uname']}">
								<img src="{$eventUser['avatar_middle']}" alt="{$eventUser['uname']}">
								<span>{$eventUser['uname']}</span>
							</a>
						</li>
					<?php } ?>
				</ul>
			<?php } ?>
			<!-- 评论 -->
			<div class="title">
				<span></span>评论
			</div>
			{:W('Comment', array('tpl' => 'detail', 'row_id' => $data['eid'], 'order' => 'DESC', 'app_uid' => $data['uid'], 'cancomment' => 1, 'cancomment_old' => 0, 'showlist' => 1, 'canrepost' => 0, 'table' => 'event_list', 'app_name' => 'Event' ,'app_detail_summary' => $data['name']))}
		</div>
	</div>
	<!-- 右边 -->
	<div class="rightbox">
		<include file="../common/right" />
	</div>
</div>

<script src="http://api.map.baidu.com/api?v=2.0&ak=wKS4vOwO4B3y2Tho6C36Er2GWItusPu7" type="text/javascript"></script>
<script type="text/javascript">
	var map = new BMap.Map("map_container"); 
	var longitude=$("#longitude").val();
	var latitude=$("#latitude").val();
	var point = new BMap.Point(longitude, latitude);  // 创建点坐标
	map.centerAndZoom(point, 18);
	 
	var myIcon = new BMap.Icon("http://api0.map.bdimg.com/images/marker_red_sprite.png", new BMap.Size(39, 35), {    
		// 指定定位位置。   
		// 当标注显示在地图上时，其所指向的地理位置距离图标左上    
		// 角各偏移10像素和25像素。您可以看到在本例中该位置即是   
		// 图标中央下端的尖角位置。    
		anchor: new BMap.Size(25, 58),    
		// 设置图片偏移。   
		// 当您需要从一幅较大的图片中截取某部分作为标注图标时，您   
		// 需要指定大图的偏移位置，此做法与css sprites技术类似。    
		imageOffset: new BMap.Size(20, 0)   // 设置图片偏移    
	});
	var marker = new BMap.Marker(point, {icon: myIcon});        // 创建标注   
	//var marker = new BMap.Marker(point);        // 创建标注   
	
	map.addOverlay(marker);                     // 将标注添加到地图中
	
	
	marker.setAnimation(BMAP_ANIMATION_BOUNCE);
	map.addControl(new BMap.NavigationControl());    
	map.addControl(new BMap.ScaleControl());    
	map.addControl(new BMap.OverviewMapControl());    
	map.addControl(new BMap.MapTypeControl()); 
	
	map.enableScrollWheelZoom(true);  //开启鼠标滚轮缩放
</script>
<include file="__THEME__/public_footer" />